<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../../public/templateMenu.xhtml"
               >

    <ui:define name="conteudo">

        <h:form>
            <p:panel  header="Crianças Achadas" >

                <h:panelGrid columns="2">

                    <h:outputLabel value="Nome: *"/>
                    <p:inputText id="nomeC" value="#{criancaBean.crianca.nome}" label="Nome" size="46"/>

                    <h:outputLabel value="Responsavel: "/>
                    <p:selectOneMenu 
                        id="responsavelID" 
                        label="#{criancaBean.crianca.responsavel.nome}" 
                        value="#{criancaBean.crianca.responsavel}" 
                        style="width: 200px; height: auto">
                        <f:selectItems value="#{criancaBean.responsaveis}"/>
                        <f:converter converterId="ResponsavelConversor"/>
                    </p:selectOneMenu>

                    <h:outputLabel for="idade" value="Idade: "/>
                    <p:inputText id="idade" value="#{criancaBean.crianca.idade}" label="Idade" size="16"/>


                    <h:outputLabel for="sexo" value="Sexo: "/>
                    <p:selectOneMenu id="sexo" value="#{criancaBean.crianca.sexo}" style="width: 200px; height: auto">
                        <f:selectItem itemLabel="Selecione uma opção" itemValue=" "/>
                        <f:selectItem itemLabel="Masculino" itemValue="M"/>
                        <f:selectItem itemLabel="Feminino" itemValue="F"/>
                    </p:selectOneMenu>

                    <h:outputLabel for="ambiente" value="Ambiente: "/>
                    <p:selectOneMenu 
                        id="eventoID" 
                        label="#{criancaBean.crianca.ambiente.nome}" 
                        value="#{criancaBean.crianca.ambiente}" 
                        style="width: 200px; height: auto">
                        <f:selectItems value="#{criancaBean.eventos}"/>
                        <f:converter converterId="EventoConversor"/>
                    </p:selectOneMenu>
                    
                    <h:outputLabel for="perdido" value="Data Perdida: "/>
                    <p:calendar  pattern="dd/MM/yyyy" id="perdido" value="#{criancaBean.crianca.perdida}" 
                                  />

                     <h:outputLabel for="achado" value="Data Encontrada: "/>
                     <p:calendar  id="achado" value="#{criancaBean.crianca.encontrada}" 
                                  pattern="dd/MM/yyyy"/>
                    
                     <h:outputLabel for="devolvida" value="Data Devolvida: "/>
                     <p:calendar  id="final" value="#{criancaBean.crianca.devolvida}" 
                                 pattern="dd/MM/yyyy"/>

                    <h:outputLabel for="descricão" value="Descrição"/>
                    <p:inputTextarea id="descricao" value="#{criancaBean.crianca.descricao}" label="Descriçao" rows="5" cols="40"
                                     queryDelay="150" minQueryLength="4"/>



                    <div align="south">

                        <h:panelGrid columns="6">

                            <p:commandButton value="Salvar" ajax="false" actionListener="#{criancaBean.salvar()}"/>
                            <p:commandButton value="Limpar" type="reset"/>
                            <p:commandButton value="Cancelar" action="/cadastro/crianca/listaCriancas.xhtml"/>
                        </h:panelGrid>
                    </div>

                </h:panelGrid>

            </p:panel>

        </h:form>

    </ui:define>

</ui:composition>

</html>